﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AkazoNobel.Scheduler.StoreMasterData.Common;
using AkazoNobel.Scheduler.StoreMasterData.DataAccess.Model;
using Dapper;

namespace AkazoNobel.Scheduler.StoreMasterData.DataAccess.Service
{
    public static class AssessmentService
    {

        public static Assessment GetLastLikeKey(string key)
        {
            Assessment assessment;
            using (var conn = SqlConnectionHelper.GetConnection(Constant.MDC_DB_NAME))
            {
                assessment = conn.Query<Assessment>("SELECT * FROM t_Assessment WHERE BusinessKey like @BusinessKey ORDER BY BusinessKey DESC",
                    new { BusinessKey = key+"%" }).FirstOrDefault();
            }

            return assessment;
        }
    }
}
